<template>
  <div class="nav-bar-wrapper" :class="isCollapse ? 'collapse-wrapper' : ''">
    <div class="header">
      <img class="imgs" src="../../assets/image/right.svg" v-if="isCollapse" alt="" @click="collapse">
      <img class="imgs" src="../../assets/image/left.svg" v-else alt="" @click="collapse">
      <div v-if="!isCollapse">
        <img src="@/assets/image/logo.svg" alt="">
        <label class="font-family">Amateras</label>
      </div>
    </div>
    <ul class="nav-bar-list">
      <li class="item">
        <img src="@/assets/image/notice.svg" alt="" class="notice">
        <label class="font-medium fon" v-if="!isCollapse">Presales</label>
      </li>
      <!--      @click="navbarlists()"-->
      <li class="item coming">
        <img src="@/assets/image/trades.svg" alt="" class="notice">
        <label class="font-medium conrs" v-if="!isCollapse">NFT Market</label>
        <p class="imgSoon">Coming Soon...</p>
      </li>
      <li class="item">
        <img src="@/assets/image/airdrop.svg" alt="" class="notice">
        <label class="font-medium conrs" v-if="!isCollapse">Airdrop</label>
        <p class="imgSoon">Coming Soon...</p>

      </li>
      <li class="item">
        <img src="@/assets/image/dollar-sign.svg" alt="" class="notice">
        <label class="font-medium conrs" v-if="!isCollapse">Bonuses pool</label>
        <p class="imgSoon">Coming Soon...</p>

      </li>
      <li class="item">
        <img src="@/assets/image/lotteryr.svg" alt="" class="notice">
        <label class="font-medium conrs" v-if="!isCollapse">Burning</label>
        <p class="imgSoon">Coming Soon...</p>

      </li>
      <li class="footer">
        <label style="cursor:pointer">
          <img src="@/assets/image/telegram.svg" alt="" @click="tel"/>
        </label>
        <label style="cursor:pointer">
          <img src="@/assets/image/Twitter.svg" alt="" @click="twitter"/>
        </label>
        <label style="cursor:pointer">
          <img src="@/assets/image/medium.svg" alt="" @click="medium"/>
        </label>
        <div style="cursor:pointer;position: relative" class="discords">
          <img class="footerImg" src="@/assets/image/discord.svg" alt=""/>
          <p class="imgSoon">Coming Soon...</p>
        </div>
      </li>
    </ul>
  </div>
</template>

<script>
import {
  detectDeviceType,
} from '@/utils';
import { mapState, mapMutations } from 'vuex';
import { chainName } from '@/utils/constants';

export default {
  props: {
    initStatus: {
      type: Boolean,
      default: () => true,
    },
  },
  data() {
    return {
      address: '',
      chainName,
      isCollapse: this.initStatus,
      from: {
        trades: false,
      },

    };
  },
  computed: {
    ...mapState(['chainId', 'isShowAside']),
  },
  created() {
    console.log(detectDeviceType());
    this.address = sessionStorage.getItem('address');
    this.updateCurrentAddress(this.address);
  },
  watch: {
    isCollapse(news, old) {
      this.isCollapse = news;
    },
  },
  methods: {
    ...mapMutations(['updateCurrentAddress', 'updateIsShowAside', 'updateTheme']),

    // navbarlists(event){
    //   console.log('=======',event)
    //   // if(data==pre){
    //   //    that.from[pre]=!that.from[pre]
    //   //          setTimeout(function(){this.from[pre]=false,3000);
    //   //                                                   ^
    //   //      }else {
    //   //      that.from[pre]=false
    //   //      }
    //
    // },
    alset(data) {
      const that = this;
      that.alsets = setTimeout(() => {
        that.from[data] = false;
      }, 3000);
    },
    collapse() {
      this.isCollapse = !this.isCollapse;
      this.$emit('collapse', this.isCollapse);
    },
    tel() {
      window.open('https://t.me/amatereras');
    },
    twitter() {
      window.open('https://twitter.com/amateras_app?s=21');
    },
    medium() {
      window.open('https://medium.com/@amateras-io');
    },

  },
};
</script>

<style lang="scss" scoped>
  @import '@/style/variable.scss';

  .nav-bar-wrapper {
    width: 250px;
    height: 100%;
    box-sizing: border-box;
    position: fixed;
    left: 0;
    right: 0;
    z-index: 1001;
    background: #3C434A;

    .header {
      height: 60px;
      line-height: 60px;
      display: flex;
      justify-content: space-between;
      align-items: center;

      img {
        vertical-align: middle;
        position: relative;
        cursor: pointer;
        margin-left: 20px;
        width: 32px;
      }

      .imgs {
        width: 24px;
      }

      img {
        display: inline-block;
        vertical-align: middle;
        margin-right: 12px;
        position: relative;
      }

      label {
        font-size: 16px;
        margin-right: 25px;
      }
    }

    .nav-bar-list {
      position: relative;
      height: 100%;

      li {
        line-height: 60px;
        padding: 0 25px;
        box-sizing: border-box;
        position: relative;

        .conrs {
          color: rgba(255, 255, 255, 0.3);
          position: relative;
          top: 4px;
          font-size: 16px;

        }

        .fon {
          font-size: 16px;
        }

        .imgSoon {
          background: url(../../assets/image/Union.svg) no-repeat;
          background-size: 100%;
          width: 202px;
          height: 47px;
          text-align: center;
          color: #333333;
          display: flex;
          align-items: center;
          justify-content: center;
          font-size: 18px;
          position: absolute;
          top: 0;
          left: 75%;
          visibility: hidden;

        }

        img {
          width: 24px;
          height: 24px;
        }
      }

      li.item:hover > p {
        visibility: visible;
      }


      .notice {
        margin-right: 16px;
        vertical-align: middle;
      }

      .footer {
        border-top: 1px solid $theme;
        padding-top: 10px;
        box-sizing: border-box;
        position: absolute;
        bottom: 60px;
        width: 100%;

        img {
          margin-right: 10%;
          width: 24px;
          height: 24px;
        }

        div {
          display: inline-block;
        }

        .footerImg {
          position: relative;
        }

        .discords {
          position: relative;
        }

        .imgSoon {
          background: url(../../assets/image/Union.svg) no-repeat;
          width: 202px;
          height: 47px;
          text-align: center;
          color: #333333;
          display: flex;
          align-items: center;
          justify-content: center;
          font-size: 18px;
          position: absolute;
          top: -20px;
          left: 100%;
          visibility: hidden;
        }

        .discords:hover > p {
          visibility: visible;
        }
      }
    }
  }


  .collapse-wrapper {
    width: 88px;

    .footer {
      display: flex;
      flex-direction: column;
      padding-bottom: 24px !important;
      box-sizing: border-box;
      justify-content: space-around;
      height: 200px;

      img {
        margin: 0;
        width: 24px;
        height: 24px;
        /*margin-top: 50%;*/

      }


    }
  }

</style>
